<template>
  <div>
    <!-- el-table
         el-table
             data:数据
             el-table-column
                 label:标题
                 width:宽度
                 prop:对应数据的字段名

             作用域插槽
                #default={row,$index}
                row:当前行数据
                $index:下标，从0开始

-->
    <el-table :data="tableData" border>
      <el-table-column label="序号">
        <template #default="{$index}">
          <div>
            {{ $index+1 }}
          </div>
        </template>
      </el-table-column>
      <el-table-column label="日期" prop="date" />
      <el-table-column label="姓名" prop="name" />
      <el-table-column label="地址" prop="address" />
      <el-table-column label="操作">
        <template #default="{row,$index}">
          <div>
            <el-button type="success">编辑</el-button>
            <el-button type="danger">删除</el-button>
            <el-button type="primary">查看</el-button>
            {{ row }}----{{ $index }}
          </div>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>
<script>
export default {
  data() {
    return {
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1518 弄'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1517 弄'
      }, {
        date: '2016-05-01',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1519 弄'
      }, {
        date: '2016-05-03',
        name: '王小虎',
        address: '上海市普陀区金沙江路 1516 弄'
      }]
    }
  }
}
</script>
<style>
</style>
